package com.pachong.android.frameworkbase.utils.ui;

import android.text.InputFilter;
import android.text.InputType;
import android.widget.EditText;

import com.pachong.android.frameworkbase.customviews.IconTextArrowEditText;

/**
 * EditText Helper
 *
 * @Author: Administrator
 * @E-mail: pengveivei@sina.cn
 * @CreateDate: 2016/11/28 15:48
 * @Version: 1.0.0
 */
public class EditTextHelper {

    private static IconTextArrowEditText maxLength;

    /**
     * EditText 只能输入电话号码， 且只有11位
     * @param et
     */
    public static void setToPhoneType(EditText et) {
        setToPhoneType(et, 11);
    }


    /**
     * EditText 只能输入电话号码， 且只有11位
     * @param et
     */
    public static void setToPhoneType(EditText et, int length) {
        et.setInputType(InputType.TYPE_CLASS_PHONE);
        et.setFilters(new InputFilter[]{new InputFilter.LengthFilter(length)});
    }

    public static void setMaxLength(EditText et, int maxLength) {
        et.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
    }
}
